import { defineStore } from "pinia";
import {ref} from 'vue'

export const useTokenStore = defineStore('token',()=>{
    //响应式变量
    const token = ref('')

    //修改token值的函数
    const setToken = (newToken)=>{
        token.value = newToken
    }

    //移除token值的函数
    const removeToken = ()=>{
        token.value = ''
    }

    return {
        token,setToken,removeToken
    }
},{
    //持久化存储
    persist:true
});